﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DCTAccess.Business
{
    public enum IntegerCompareTypes
    {
        Equals,
        NotEqual,
        GreaterThan,
        GreaterOrEqual,
        LessThan,
        LessOrEqual,
        Like
    }

    public class IntegerCompareSQLBuilder
    {
        public static string GetSQL(string fieldName, IntegerCompareTypes compareType, string value)
        {
            string sqlOperator = string.Empty;

            switch (compareType)
            {
                case IntegerCompareTypes.Equals:
                    sqlOperator = "=";
                    break;
                case IntegerCompareTypes.GreaterOrEqual:
                    sqlOperator = ">=";
                    break;
                case IntegerCompareTypes.GreaterThan:
                    sqlOperator = ">";
                    break;
                case IntegerCompareTypes.LessOrEqual:
                    sqlOperator = "<=";
                    break;
                case IntegerCompareTypes.LessThan:
                    sqlOperator = "<";
                    break;
                case IntegerCompareTypes.NotEqual:
                    sqlOperator = "<>";
                    break;
                case IntegerCompareTypes.Like:
                    sqlOperator = "Like";
                    break;
            }

            return string.Format(" ({0} {1} {2}) ", fieldName, sqlOperator, value);
        }
    }
}
